﻿using PetaPoco;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace Cxuu.Models
{
    [TableName("cxuu_admin_dept")]
    [PrimaryKey("Id", AutoIncrement = true)]
    public class AdminUserDept
    {
        public int Id { get; set; }
        public int Pid { get; set; }
        public string DeptName { get; set; }
        public int OrderNum { get; set; }
        public string ArticleCateRole { get; set; }
        public string ContentCateRole { get; set; }
        public DateTime GreatTime { get; set; }
        public string Remark { get; set; }

    }

    public class EditAdminUserDept
    {
        public int Id { get; set; }

        [Required(ErrorMessage = "请输入{0}")]
        [Display(Name = "上级部门")]
        public int Pid { get; set; }
        [Required(ErrorMessage = "请输入{0}")]
        [Display(Name = "部门名称")]
        public string DeptName { get; set; }
        [Required(ErrorMessage = "请输入{0}")]
        [Display(Name = "部门排序")]
        [RegularExpression(RegxPatterns.Number, ErrorMessage = "{0}必须为数字")]
        public int OrderNum { get; set; }

        [Required(ErrorMessage = "请输入{0}")]
        [Display(Name = "所在部门")]
        public DateTime GreatTime { get; set; }
        public string Remark { get; set; }

    }


    public class ViewAdminUserDept
    {
        public int Id { get; set; }
        public int Pid { get; set; }
        public string DeptName { get; set; }
        public int OrderNum { get; set; }
        public DateTime GreatTime { get; set; }
        public string Remark { get; set; }
        public int Depth { get; set; }

        public string Spread { get; set; }

        public int ChildrenCount { get; set; }

        public bool HaveChild { get; set; }
        public bool Open { get; set; }

        public List<ViewAdminUserDept> Children { set; get; } = new();


        public string Title { set; get; }
    }

    public class AdminUserDeptCateRole
    {
        public int Id { get; set; }
        [Display(Name = "工作类别权限")]
        public string ArticleCateRole { get; set; }
        [Display(Name = "网站栏目权限")]
        public string ContentCateRole { get; set; }
        public string DeptName { get; set; }


    }
}
